<template>
    <div class="studentifo">
        <h3 v-text="msg"></h3>
        <p>学生姓名：{{name}}</p>
        <p>年龄：{{age}}</p>
        <button @click="sendMsg">发布消息</button>
    </div>
</template>

<script>
//引入消息订阅对象
import pubsub from "pubsub-js"
export default {
    name:"StudentNa",
    data(){
        return {
            msg:"学生个人信息",
            name:'苏凉',
            age:21,
            student_address:''
        }
    },
    methods:{
        sendMsg(){
            pubsub.publish('message',this.name)
        }
    },
}
</script>

<style>
    .studentifo{
        background-color: black;
    }
</style>
